package com.jarvis.zeng.design.pattern.filter.demo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author ZengJun
 */
public class Main {
    public static void main(String[] args) {

        Criteria maleCriteria = new MaleCriteria();
        Criteria femaleCriteria = new FemaleCriteria();
        Criteria singleCriteria = new SingleCriteria();
        Criteria singleFemale = new AndCriteria(singleCriteria,femaleCriteria);
        Criteria signleOrMale = new OrCritiria(singleCriteria,maleCriteria);

        System.out.println("女性:"+femaleCriteria.meetCriteria(getPersonLit()));
        System.out.println("男性:"+maleCriteria.meetCriteria(getPersonLit()));
        System.out.println("单身女性"+singleFemale.meetCriteria(getPersonLit()));
        System.out.println("单身或男性"+signleOrMale.meetCriteria(getPersonLit()));
    }

    private static List<Person> getPersonLit(){
        return new ArrayList<Person>(Arrays.asList(
                new Person("张三","男性","未婚"),
                new Person("李四","男性","已婚"),
                new Person("王五","女性","未婚"),
                new Person("赵六","女性","已婚"),
                new Person("孙七","男性","未婚"),
                new Person("周八","女性","未婚")
        ));
    }
}
